package com.example.aerospacemanagementsystem.controller.personnel;

import com.example.aerospacemanagementsystem.entity.personnel.Employee;
import com.example.aerospacemanagementsystem.service.personnelService.EmployeeService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 吴欣悦
 */
@Api(tags = "员工")
@RestController
@CrossOrigin
@RequestMapping("/employee")
public class EmployeeController {
    @Autowired
    private EmployeeService employeeService;
    //添加员工
    @PostMapping
    public int add(@RequestBody Employee employee){
        return employeeService.add(employee);
    }
    //删除员工
    @DeleteMapping
    public int delete(Employee employee){
        return employeeService.delete(employee);
    }
    //修改员工
    @PutMapping
    public int update(@RequestBody Employee employee){
        return employeeService.update(employee);
    }
    //获取员工
    @GetMapping("/getAll")
    public List<Employee> getAllCity(Employee employee) {
        List<Employee> list = employeeService.getAllEmployee(employee);
        return list;
    }
}
